﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Implementation;

namespace civilizationWPF
{
    /// <summary>
    /// Logique d'interaction pour MenuWindow.xaml
    /// </summary>
    public partial class MenuWindow : Window
    {
        public MenuWindow()
        {
            InitializeComponent();
        }

        
        private void quitter_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void nPartie_Click(object sender, RoutedEventArgs e)
        {
            Window w = new NouvellePartieWindow();
            w.Visibility = Visibility;
            this.Close();
        }

        private void chargerP_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
            ofd.DefaultExt = ".sauv"; // Default file extension 
            // Show open file dialog box
            Nullable<bool> result = ofd.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string filename = ofd.FileName;
                Jeu j = Jeu.loadGame(filename);
                Window w = new MainWindow(j);
                w.Visibility = Visibility;
                this.Close();
            }
        }
    }
}
